Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Collect command | Different Cells formats

    Hi,

    regarding Stata 17's new command, collect, which includes table command, I was wondering if it is possible to have different columns formats:

    Code:
    . clear
    
    . webuse auto
    (1978 automobile data)
    
    
    . table (foreign ), stat(mean price turn) nformat(%3.1f)
    
    ----------------------------------------
               |   Price   Turn circle (ft.)
    -----------+----------------------------
    Car origin |                            
      Domestic |  6072.4                41.4
      Foreign  |  6384.7                35.4
      Total    |  6165.3                39.6
    ----------------------------------------
    I was expecting to obtain:

    Code:
    ----------------------------------------
               |   Price   Turn circle (ft.)
    -----------+----------------------------
    Car origin |                            
      Domestic |  6,072                41.4
      Foreign  |  6,384                35.4
      Total    |  6,165                39.6
    ----------------------------------------
    thanks

  • #2
    You can specify different format for each variable:

    Code:
    . webuse auto
    (1978 automobile data)
    
    . table (foreign ), stat(mean price turn)
    
    ------------------------------------------
               |     Price   Turn circle (ft.)
    -----------+------------------------------
    Car origin |                              
      Domestic |  6072.423            41.44231
      Foreign  |  6384.682            35.40909
      Total    |  6165.257            39.64865
    ------------------------------------------
    
    . collect style cell var[turn], nformat(%3.1f)
    
    . collect style cell var[price], nformat(%9.0fc)
    
    . collect preview
    
    ---------------------------------------
               |  Price   Turn circle (ft.)
    -----------+---------------------------
    Car origin |                           
      Domestic |  6,072                41.4
      Foreign  |  6,385                35.4
      Total    |  6,165                39.6
    ---------------------------------------

    Comment

    Working...
    X